{% extends 'crm/base/base.html' %}
{% load grade_pub %}
{% load static %}

{% block title %}
    学生详情页
{% endblock %}
{% block section %}
    {{ section }}
{% endblock %}

{% block content %}

    <form class="form-horizontal" method="post">
    {% csrf_token %}
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">头像</label>
    <div class="col-sm-5">
     <img src="{{ stu.image_url }}" alt="" class="img-rounded" style="width: 100px;height: 100px;">

    <input name="image_url" id="image_url" value="{{ stu.image_url }}" type="text" style="display:none">
     <input type="file" class="files">
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" id="name" placeholder="姓名" name="name" value="{{ stu.name }}">
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">年龄</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" id="age"  name="age" value="{{ stu.age }}" maxlength="3" oninput = "value=value.replace(/[^\d]/g,'')">
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">性别</label>
    <div class="col-sm-5">
        <label class="radio-inline">
          <input type="radio" name="sex" id="inlineRadio1" value="1"{% if stu.sex == 1 %}checked{% endif %}> 男
        </label>
        <label class="radio-inline">
          <input type="radio" name="sex" id="inlineRadio2" value="0"{% if stu.sex == 0 %}checked{% endif %}> 女
        </label>
        <label class="radio-inline"><input type="radio" name="sex" id="inlineRadio3" value="3" {% if stu.sex == 3 %}checked{% endif %}> 保密
        </label>
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">QQ</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" id="qq"  name="qq" value="{{ stu.qq }}" maxlength="11" oninput = "value=value.replace(/[^\d]/g,'')">
    </div>
  </div>
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label" >电话</label>
    <div class="col-sm-5">
      <input type="text" class="form-control" id="phone"  name="phone" value="{{ stu.phone }}" maxlength="11" oninput = "value=value.replace(/[^\d]/g,'')">
    </div>
  </div>

    {% if section != '学生信息添加' %}
  <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">创建时间</label>
    <div class="col-sm-5">
      <input type="datetime-local" class="form-control" id="c_time" name="c_time"  value="{{ stu.c_time | date:"Y-m-d\TH:i"}}">
    </div>
  </div>
    {% endif %}
    <div class="form-group">
    <label for="inputEmail3" class="col-sm-2 control-label">班期</label>
    <div class="col-sm-5">
{#      <select class="form-control" name="grade">#}
{#      <option value="0">未分班</option>#}
{#          {% for i in grade %}#}
{#          <option {% if i.id == stu.g_id %} selected {% endif %} value="{{ i.id }}" >{{ i }}</option>#}
{#          {% endfor %}#}
{##}
{#     </select>#}
        {% grades stu %}
    </div>
  </div>


  <div class="form-group">
    <div class="col-sm-offset-2 col-sm-10">
      <button type="submit" class="btn btn-success">保存</button>
      <a href="{% url 'crm:index' %}" class="btn btn-primary">取消</a>
      <a href="{% url 'crm:index' %}" class="btn btn-default">返回</a>
    </div>
  </div>
</form>
{% endblock %}
{% block script %}
    <script src="{% static 'js/file.js' %}"></script>
{% endblock %}


